<template>
  <view></view>
</template>

<script>
import page from "@/mixins/page"
export default {
  name: "",
  mixins: [page],
  data() {
    return {}
  },
  onLoad(options) {
    let payParams = decodeURIComponent(options.payParams)
    payParams = JSON.parse(payParams)
    uni.$pay.weChatMpPay(
      {
        timeStamp: payParams.timeStamp + "",
        nonceStr: payParams.nonceStr,
        package: payParams.package,
        signType: payParams.signType,
        paySign: payParams.paySign
      },
      () => {
        this.useRouteJupm({
          jumpType: "url",
          url: payParams.backUrl
        })
      },
      (err) => {
        if (err.errMsg.indexOf("cancel") === -1) {
          this.$toast("支付失败")
        } else {
          this.$toast("支付取消")
        }
        setTimeout(() => {
          this.useRouteJupm({
            jumpType: "url",
            url: payParams.frontUrl
          })
        }, 800)
      }
    )
  },
  methods: {}
}
</script>
<style lang="scss" scoped></style>
